<?php
/**
 * GeoContexter
 * @link http://code.google.com/p/geocontexter/
 * @package GeoContexter
 */

/**
 * spatial search for record items
 *
 * @package GeoContexter
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @author Armand Turpel <geocontexter@gmail.com>
 * @version $Rev: 153 $ / $LastChangedDate: 2010-02-18 17:21:41 +0100 (jeu., 18 févr. 2010) $ / $LastChangedBy: armand.turpel $
 */

namespace Gospecies\Controller;

use Zend\View\Model\ViewModel;
use Gospecies\Controller\AbstractIdentityJsonController;
use Zend\View\Model\JsonModel;

class AjaxGetAttributeGroupsJsonController extends AbstractIdentityJsonController
{

    /**
     */
    public function indexAction()
    {


        try {

          $AttributeGroupsGet = $this->CoreModel('AttributeGroupsGet');

          $params['id_table'] = 1;

          $atttribute_groups = $AttributeGroupsGet->run($params);


          if ($atttribute_groups instanceof \Core\Library\Exception) {
              return new JsonModel(array('error' => $atttribute_groups->getMessage()));

          }

          return new JsonModel($atttribute_groups);

          } catch (\Exception $e) {

            $this->default_error = "Error\n File: " . __file__ . "\nLine: " . __line__ . "\nError: " . $e->getMessage();

            return new JsonModel(array('error' => $this->default_error));

         }

    }
}

